//
//  KSCountView.swift
//  PigManager
//
//  Created by 邱仙凯 on 2017/11/2.
//  Copyright © 2017年 Much. All rights reserved.
//

import UIKit



class KSCountView: JWCountButton {
    var valueBlock:((String) -> ())?
    /*
    // Only override draw() if you perform custom drawing.
    // An empty implementation adversely affects performance during animation.
    override func draw(_ rect: CGRect) {
        // Drawing code
    }
    */
    override func awakeFromNib() {
 
        initUI()
    }
    
    override init(frame: CGRect) {
        super.init(frame:frame)
        initUI()
    }
    
    required init?(coder aDecoder: NSCoder) {
        super.init(coder: aDecoder)
        initUI()
    }
 
    func initUI() {
        
        self.shakeAnimation = true
        self.longPressSpaceTime = 0.02
        self.maxValue = 1000
        self.minValue = 0
        self.increaseImage = UIImage(named:"coupon_increase")
        self.decreaseImage = UIImage(named:"coupon_decrease")
        self.valueChanged = { [unowned self] number, isIncrease in
            let renum = number as? Double
            print( "\(renum)")

            let aa = isIncrease ? "加":"减"
            print(aa + "\(number)")
            self.valueBlock!("\(number)")
         
        }
        
    }

}
